<?php
load_theme_textdomain('clearcut');
class clearcut {
	function addOptions () {
		if (isset($_POST['clearcut_reset'])) { clearcut::initOptions(true); }
		if (isset($_POST['clearcut_save'])) {
			$aOptions = clearcut::initOptions(false);
		
			$aOptions['featured1-image'] = stripslashes($_POST['featured1-image']);
			$aOptions['featured1-link'] = stripslashes($_POST['featured1-link']);

			$aOptions['featured2-image'] = stripslashes($_POST['featured2-image']);
			$aOptions['featured2-link'] = stripslashes($_POST['featured2-link']);					

			$aOptions['featured3-image'] = stripslashes($_POST['featured3-image']);
			$aOptions['featured3-link'] = stripslashes($_POST['featured3-link']);

			$aOptions['featured4-image'] = stripslashes($_POST['featured4-image']);
			$aOptions['featured4-link'] = stripslashes($_POST['featured4-link']);

			$aOptions['featured5-image'] = stripslashes($_POST['featured5-image']);
			$aOptions['featured5-link'] = stripslashes($_POST['featured5-link']);
                        
                        $aOptions['featured6-image'] = stripslashes($_POST['featured6-image']);
			$aOptions['featured6-link'] = stripslashes($_POST['featured6-link']);

                        $aOptions['featured7-image'] = stripslashes($_POST['featured7-image']);
			$aOptions['featured7-link'] = stripslashes($_POST['featured7-link']);
			update_option('clearcut_theme', $aOptions);
		}
		add_theme_page("clearcut Theme Options", "clearcut Options", 'edit_themes', basename(__FILE__), array('clearcut', 'displayOptions'));
	}
	function initOptions ($bReset) {
		$aOptions = get_option('clearcut_theme');
		if (!is_array($aOptions) || $bReset) {
			$aOptions['featured1-image'] = 'http://f1ezine.com/';
			$aOptions['featured1-link'] = 'http://f1ezine.com/';
			
			$aOptions['featured2-image'] = 'http://f1ezine.com/';
			$aOptions['featured2-link'] = 'http://f1ezine.com/';	

			$aOptions['featured3-image'] = 'http://f1ezine.com/';
			$aOptions['featured3-link'] = 'http://f1ezine.com/';

			$aOptions['featured4-image'] = 'http://f1ezine.com/';
			$aOptions['featured4-link'] = 'http://f1ezine.com/';

			$aOptions['featured5-image'] = 'http://f1ezine.com/';
			$aOptions['featured5-link'] = 'http://f1ezine.com/';

                        $aOptions['featured6-image'] = 'http://f1ezine.com/';
			$aOptions['featured6-link'] = 'http://f1ezine.com/';
                         
                        $aOptions['featured7-image'] = 'http://f1ezine.com/';
			$aOptions['featured7-link'] = 'http://f1ezine.com/';

			update_option('clearcut', $aOptions);
		}
		return $aOptions;
	}
	function displayOptions () {
		$aOptions = clearcut::initOptions(false);
?>
<div class="wrap">
	<h2>clearcut Theme Options</h2>
	<p>You can edit ad options including the links and img url by using the fields below.</p>
    <div style="margin-left:0px;">
    <form action="#" method="post" enctype="multipart/form-data" name="massive_form" id="massive_form">
		<fieldset name="general_options" class="options">
        <div style="border-bottom:1px solid #333;"></div>
        <h3 style="margin-bottom:0px;">Ad Options:</h3>
        <p style="margin-top:0px;">You can add up to five ads by filling out the fields below.</p>
        
<h3>Ads no #1</h3>
       
        Ad Image Location :<br />
		<div style="margin:0;padding:0;">
        <input name="featured1-image" id="featured1-image" size="30" value="<?php echo($aOptions['featured1-image']); ?>"></input> 
        </div><br />
        
        Links To:<br />
		<div style="margin:0;padding:0;">
        <input name="featured1-link" id="featured1-link" size="30" value="<?php echo($aOptions['featured1-link']); ?>"></input>   
        </div><br />
        
<h3>Ads no #2</h3>
        
        Ad Image Location :<br />
		<div style="margin:0;padding:0;">
        <input name="featured2-image" id="featured2-image" size="30" value="<?php echo($aOptions['featured2-image']); ?>"></input> 
        </div><br />
        
        Links To:<br />
		<div style="margin:0;padding:0;">
        <input name="featured2-link" id="featured2-link" size="30" value="<?php echo($aOptions['featured2-link']); ?>"></input>    
        </div><br />
        
     
<h3>Ads no #3</h3>
        
        Ad Image Location :<br />
		<div style="margin:0;padding:0;">
        <input name="featured3-image" id="featured3-image" size="30" value="<?php echo($aOptions['featured3-image']); ?>"></input>
        </div><br />
        
        Links To:<br />
		<div style="margin:0;padding:0;">
        <input name="featured3-link" id="featured3-link" size="30" value="<?php echo($aOptions['featured3-link']); ?>"></input>  
        </div><br />
        
<h3>Ads no #4</h3>
        
        Ad Image Location :<br />
		<div style="margin:0;padding:0;">
        <input name="featured4-image" id="featured4-image" size="30" value="<?php echo($aOptions['featured4-image']); ?>"></input>
        </div><br />
        
        Links To:<br />
		<div style="margin:0;padding:0;">
        <input name="featured4-link" id="featured4-link" size="30" value="<?php echo($aOptions['featured4-link']); ?>"></input>    
        </div><br />
        
<h3>Ads no #5</h3>
        
        Ad Image Location :<br />
		<div style="margin:0;padding:0;">
        <input name="featured5-image" id="featured5-image" size="30" value="<?php echo($aOptions['featured5-image']); ?>"></input>  
        </div><br />
        
        Links To:<br />
        <div style="margin:0;padding:0;">
		<input name="featured5-link" id="featured5-link" size="30" value="<?php echo($aOptions['featured5-link']); ?>"></input> 
        </div><br />   

<h3>Ads no #6</h3>
        
        Ad Image Location :<br />
		<div style="margin:0;padding:0;">
        <input name="featured6-image" id="featured6-image" size="30" value="<?php echo($aOptions['featured6-image']); ?>"></input>  
        </div><br />
        
        Links To:<br />
        <div style="margin:0;padding:0;">
		<input name="featured6-link" id="featured6-link" size="30" value="<?php echo($aOptions['featured6-link']); ?>"></input> 
        </div><br />   

<h3>Ads no #7</h3>
        
        Ad Image Location :<br />
		<div style="margin:0;padding:0;">
        <input name="featured7-image" id="featured7-image" size="30" value="<?php echo($aOptions['featured7-image']); ?>"></input>  
        </div><br />
        
        Links To:<br />
        <div style="margin:0;padding:0;">
		<input name="featured7-link" id="featured7-link" size="30" value="<?php echo($aOptions['featured7-link']); ?>"></input> 
        </div><br />   
        
<div style="border-bottom:1px solid #333;"></div>
		</fieldset>
		<p class="submit"><input type="submit" name="clearcut_reset" value="Reset" /></p>
		<p class="submit"><input type="submit" name="clearcut_save" value="Save" /></p>
	</form>      
</div>
<?php
	}
}
// Register functions
add_action('admin_menu', array('clearcut', 'addOptions'));
?>